<template>
	<div class="" style="width: 100%;">
		<head-top></head-top>

	
		<div class="table_container" :style="'width: 90%;  overflow: hidden; '">
			<div style="margin: 5px; display: flex;">
				
				
				

				<span style="font-size: medium; padding: 10px;">日期:</span>
				<el-select v-model="date_choice" size="small" clearable filterable placeholder="请选择"
					@change="changedate_choice()">
					<el-option v-for="item in date_options" :key="item.label" :label="item.label" :value="item.value">
					</el-option>
				</el-select>
				
				<div >
					<el-button   style="margin-left: 15px;"   :disabled="allow_do_commond" size="mini" type="success" @click="refleash()">刷新</el-button>
				</div>
				
				
			</div>
			<div style="margin: 5px; display: flex;">
				<span style="font-size: 20px;width: 120px;"> 赎回未出金  </span>
				
			</div>
			<el-table ref="singleTable" :data="arrange_data1" height="300px" border size='small' :fit='true'
				:style="'overflow-y: scroll ;width:'+(screenWidth*1.0)+'px;'"  >
				<el-table-column prop="id" label="id" align></el-table-column>
				<el-table-column prop="kkdate" label="date"  align></el-table-column>
				<el-table-column prop="program_code" label="program_code"  align></el-table-column>
				<el-table-column prop="action_type" label="action_type"  align></el-table-column>
				<el-table-column prop="chg_amount_netvalue" label="chg_amount_netvalue"  align></el-table-column>
				<el-table-column prop="chg_amount_cta" label="chg_amount_cta"  align></el-table-column>
				<el-table-column prop="chg_to_today_portion" label="chg_to_today_portion"  align></el-table-column>
				<el-table-column prop="already_in_qry" label="already_in_qry"  align></el-table-column>
				<el-table-column prop="future_in_transit" label="future_in_transit"  align></el-table-column>
				<el-table-column prop="note" label="note"  align></el-table-column>
				<el-table-column prop="status" label="状态" width="120" align>
					<template slot-scope="scope">
						<el-select  v-model="scope.row['status']" size="small" collapse-tags style="" placeholder="请选择"
							@change=" change_cell_status($event,scope)">
							<el-option v-for="item in status_options" :key="item.value" :label="item.label"
								:value="item.value">
							</el-option>
						</el-select>
					
					</template>
				</el-table-column>
				<!-- <el-table-column prop="status" label="status"  align></el-table-column> -->
			</el-table>
			<div style="margin: 5px; display: flex;">
				<span style="font-size: 20px;width: 120px;"> 申购跟踪中  </span>
				
			</div>
			<el-table ref="singleTable" :data="arrange_data2" height="300px" border size='small' :fit='true'
				:style="'overflow-y: scroll ;width:'+(screenWidth*1.0)+'px;'"  >
				<el-table-column prop="id" label="id" align></el-table-column>
				<el-table-column prop="kkdate" label="date"  align></el-table-column>
				<el-table-column prop="program_code" label="program_code"  align></el-table-column>
				<el-table-column prop="action_type" label="action_type"  align></el-table-column>
				<el-table-column prop="chg_amount_netvalue" label="chg_amount_netvalue"  align></el-table-column>
				<el-table-column prop="chg_amount_cta" label="chg_amount_cta"  align></el-table-column>
				<el-table-column prop="chg_to_today_portion" label="chg_to_today_portion"  align></el-table-column>
				<el-table-column prop="already_in_qry" label="already_in_qry"  align></el-table-column>
				<el-table-column prop="future_in_transit" label="future_in_transit"  align></el-table-column>
				<el-table-column prop="note" label="note"  align></el-table-column>
				<el-table-column prop="status" label="状态" width="120" align>
					<template slot-scope="scope">
						<el-select  v-model="scope.row['status']" size="small" collapse-tags style="" placeholder="请选择"
							@change=" change_cell_status($event,scope)">
							<el-option v-for="item in status_options" :key="item.value" :label="item.label"
								:value="item.value">
							</el-option>
						</el-select>
					
					</template>
				</el-table-column>
				<!-- <el-table-column prop="status" label="status"  align></el-table-column> -->
			</el-table>
			<div style="margin: 5px; display: flex;">
				<span style="font-size: 20px;width: 120px;">至今未完成  </span>
			</div>
			<el-table ref="singleTable" :data="arrange_data3" height="300px" border size='small' :fit='true'
				:style="'overflow-y: scroll ;width:'+(screenWidth*1.0)+'px;'" >
				<el-table-column prop="id" label="id" align></el-table-column>
				<el-table-column prop="kkdate" label="date"  align></el-table-column>
				<el-table-column prop="program_code" label="program_code"  align></el-table-column>
				<el-table-column prop="action_type" label="action_type"  align></el-table-column>
				<el-table-column prop="chg_amount_netvalue" label="chg_amount_netvalue"  align></el-table-column>
				<el-table-column prop="chg_amount_cta" label="chg_amount_cta"  align></el-table-column>
				<el-table-column prop="chg_to_today_portion" label="chg_to_today_portion"  align></el-table-column>
				<el-table-column prop="already_in_qry" label="already_in_qry"  align></el-table-column>
				<el-table-column prop="future_in_transit" label="future_in_transit"  align></el-table-column>
				<el-table-column prop="note" label="note"  align></el-table-column>
				<el-table-column prop="status" label="状态" width="120" align>
					<template slot-scope="scope">
						<el-select  v-model="scope.row['status']" size="small" collapse-tags style="" placeholder="请选择"
							@change=" change_cell_status($event,scope)">
							<el-option v-for="item in status_options" :key="item.value" :label="item.label"
								:value="item.value">
							</el-option>
						</el-select>
					
					</template>
				</el-table-column>
				<!-- <el-table-column prop="status" label="status"  align></el-table-column> -->
			</el-table>
			<div style="margin: 5px; display: flex;">
				<span style="font-size: 20px;width: 120px;">今日新增  </span>
				<el-button size="mini" type="primary" @click="addnew_arrange()">新增</el-button>
				
			</div>
			<el-table ref="singleTable" :data="arrange_data7" height="500px" border size='small' :fit='true'
				:style="'overflow-y: scroll ;width:'+(screenWidth*1.0)+'px;'" :row-class-name=" tableRowClassNamemoneyout7">
				<el-table-column prop="id" label="id" width="100" align></el-table-column>
				
				<el-table-column prop="kkdate" label="date" width="120"   align>
					<template slot-scope="scope">
						<el-input  v-show="scope.row['status'].indexOf('完成') == -1"  v-model="scope.row['kkdate']" 
							size="small" placeholder="" @change=" change_cell($event,scope)"></el-input>
						<span  v-show="scope.row['status'].indexOf('完成') != -1" > {{scope.row['kkdate'] }}</span> 
					</template>
					
				</el-table-column>
					
				<el-table-column prop="program_code" label="program_code" width="200"   align>
					<template slot-scope="scope">
						<el-select  v-show="scope.row['status'].indexOf('完成') == -1" v-model="scope.row['program_code']" size="small" allow-create clearable filterable
							 style="" placeholder="请选择"
							@change=" change_cell($event,scope)">
							<el-option v-for="item in account_options" :key="item.value" :label="item.label"
								:value="item.value">
							</el-option>
						</el-select>
						<span  v-show="scope.row['status'].indexOf('完成') != -1" > {{scope.row['program_code'] }}</span> 
					</template>
				</el-table-column>
				
				
				<el-table-column prop="action_type" label="action_type" width="140"   align>
					<template slot-scope="scope">
						<el-select  v-show="scope.row['status'].indexOf('完成') == -1" v-model="scope.row['action_type']" size="small"clearable filterable allow-create
						   collapse-tags style="" placeholder="请选择"
							@change=" change_cell($event,scope)">
							<el-option v-for="item in direction_options" :key="item.value" :label="item.label"
								:value="item.value">
							</el-option>
						</el-select>
					     <span  v-show="scope.row['status'].indexOf('完成') != -1" > {{scope.row['action_type'] }}</span> 
					</template>
				   
				</el-table-column>
				
							
							
							
				
						
							
				<el-table-column prop="chg_amount_netvalue" label="chg_amount_netvalue" width="140" align>
					<template slot-scope="scope">
						<el-input  v-show="scope.row['status'].indexOf('完成') == -1"  v-model="scope.row['chg_amount_netvalue']"
							size="small" placeholder="" @change=" change_cell($event,scope)"></el-input>
						<span  v-show="scope.row['status'].indexOf('完成') != -1" > {{scope.row['chg_amount_netvalue'] }}</span> 
					</template>
					
				</el-table-column>
				<el-table-column prop="chg_amount_netvalue" label="amount_check" width="140" align>
					<template slot-scope="scope">
						
						<span > {{scope.row['chg_amount_netvalue'] /10000}}万</span> 
					</template>
					
				</el-table-column>
				
				<el-table-column prop="chg_amount_cta" label="chg_amount_cta" width="140" align>
					<template slot-scope="scope">
						<el-input  v-show="scope.row['status'].indexOf('完成') == -1"  v-model="scope.row['chg_amount_cta']"
							size="small" placeholder="" @change=" change_cell($event,scope)"></el-input>
						<span  v-show="scope.row['status'].indexOf('完成') != -1" > {{scope.row['chg_amount_cta'] }}</span> 
					</template>
					
				</el-table-column>
				
				<el-table-column prop="chg_to_today_portion" label="chg_to_today_portion" width="140" align>
					<template slot-scope="scope">
						<el-select  v-show="scope.row['status'].indexOf('完成') == -1" v-model="scope.row['chg_to_today_portion']" size="small"  
						   collapse-tags style="" placeholder="请选择"
							@change=" change_cell($event,scope)">
							<el-option v-for="item in yseno_options" :key="item.value" :label="item.label"
								:value="item.value">
							</el-option>
						</el-select>
						<span  v-show="scope.row['status'].indexOf('完成') != -1" > {{scope.row['chg_to_today_portion'] }}</span> 
					</template>
					
				</el-table-column>
				<el-table-column prop="already_in_qry" label="already_in_qry" width="140" align>
					<template slot-scope="scope">
						<el-select  v-show="scope.row['status'].indexOf('完成') == -1" v-model="scope.row['already_in_qry']" size="small"  
						   collapse-tags style="" placeholder="请选择"
							@change=" change_cell($event,scope)">
							<el-option v-for="item in yseno_options" :key="item.value" :label="item.label"
								:value="item.value">
							</el-option>
						</el-select>
						<span  v-show="scope.row['status'].indexOf('完成') != -1" > {{scope.row['already_in_qry'] }}</span> 
					</template>
					
				</el-table-column>
				<el-table-column prop="future_in_transit" label="future_in_transit" align>
					<template slot-scope="scope">
						<el-input  v-show="scope.row['status'].indexOf('完成') == -1" v-model="scope.row['future_in_transit']" 
							size="small" placeholder="" @change=" change_cell($event,scope)"></el-input>
						<span  v-show="scope.row['status'].indexOf('完成') != -1" > {{scope.row['future_in_transit'] }}</span> 
					</template>
					
				</el-table-column>
				
				<el-table-column prop="note" label="备注" align>
					<template slot-scope="scope">
						<el-input  v-show="scope.row['status'].indexOf('完成') == -1" v-model="scope.row['note']" 
							size="small" placeholder="" @change=" change_cell($event,scope)"></el-input>
						<span  v-show="scope.row['status'].indexOf('完成') != -1" > {{scope.row['note'] }}</span> 
					</template>
					
				</el-table-column>
				
				
				
				
				<!-- <el-table-column prop="kkupdatetime" label="更新时间" width="140" align></el-table-column> -->
				<el-table-column prop="status" label="状态" width="120" align>
					<template slot-scope="scope">
						<!-- :disabled="scope.row['status']=='完成' " -->
						<el-select  v-model="scope.row['status']" size="small" collapse-tags style="" placeholder="请选择"
							@change=" change_cell($event,scope)">
							<el-option v-for="item in status_options" :key="item.value" :label="item.label"
								:value="item.value">
							</el-option>
						</el-select>
					
					</template>
				</el-table-column>
				<el-table-column label="操作" :width='90'>
					<template slot-scope="scope">
						<el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除
						</el-button>
						<!-- <el-button size="small" type="warning" @click="index(scope.$index, scope.row)">详情</el-button> -->
					</template>
				</el-table-column>
				<!-- <el-table-column prop="status" label="status"  align></el-table-column> -->
			</el-table>
			
			
			
			
			
			<div style="margin: 5px; display: flex;">
				<span style="font-size: 20px;width: 120px;">执行脚本  </span>
			</div>
			
			<div>
				<span style="font-size: medium; padding: 7px;">--calNetValue</span>
				<el-button  style="margin-left: 15px;" :disabled="allow_do_commond" size="mini" type="warning" @click="do_command('--calNetValue')">执行</el-button>
				
			</div>
			<div>
				<span style="font-size: medium; padding: 7px;">--modifyWebpage --saveMysql</span>
				<el-button  style="margin-left: 15px;" :disabled="allow_do_commond" size="mini" type="warning" @click="do_command('--modifyWebpage --saveMysql')">执行</el-button>
			
			</div>
			<div>
				<span style="font-size: medium; padding: 7px;">--calNetValue --modifyWebpage --modifyCashCsv --saveOutputCsv --saveMysql</span>
				<el-button  style="margin-left: 15px;" :disabled="allow_do_commond" size="mini" type="warning" @click="do_command('--calNetValue --modifyWebpage --modifyCashCsv --saveOutputCsv --saveMysql')">执行</el-button>
				
			</div>
			
			
			
			
			<div style="margin: 5px; display: flex;">
				<span style="font-size: 20px;width: 120px;">错误日志  </span>
			</div>
			<el-table ref="singleTable" :data="arrange_data4" height="300px" border size='small' :fit='true'
				:style="'overflow-y: scroll ;width:'+(screenWidth*1.0)+'px;'" >
				<el-table-column prop="id" label="id" width="200" align></el-table-column>
				<el-table-column prop="kkdate" label="date" width="200"  align></el-table-column>
				<el-table-column prop="program_code" label="program_code" width="300"  align></el-table-column>
				<el-table-column prop="description" label="dianshu"  align></el-table-column>
				<el-table-column prop="kkupdatetime" label="updatetime" width="200"  align></el-table-column>
				
			</el-table>
			
			<div style="margin: 5px; display: flex;">
				<span style="font-size: 20px;width: 120px;">t0_操作  </span>
			</div>
			<el-table ref="singleTable" :data="arrange_data5" height="300px" border size='small' :fit='true'
				:style="'overflow-y: scroll ;width:'+(screenWidth*1.0)+'px;'" >
				<el-table-column prop="id" label="id" width="200" align></el-table-column>
				<el-table-column prop="kkdate" label="date" width="200"  align></el-table-column>
				<el-table-column prop="program_code" label="program_code" width="300"  align></el-table-column>
				<el-table-column prop="description" label="description"  align></el-table-column>
				<el-table-column prop="kkupdatetime" label="updatetime" width="200"  align></el-table-column>
				
			</el-table>
			
			<div style="margin: 5px; display: flex;">
				<span style="font-size: 20px;width: 120px;">点数计算  </span>
			</div>
			<el-table ref="singleTable" :data="arrange_data6" height="300px" border size='small' :fit='true'
				:style="'overflow-y: scroll ;width:'+(screenWidth*1.0)+'px;'" >
				<el-table-column prop="id" label="id" align></el-table-column>
				<el-table-column prop="kkdate" label="kkdate"  align></el-table-column>
				<el-table-column prop="program_code" label="program_code"  align></el-table-column>
				<el-table-column prop="dianshu" label="dianshu"  align></el-table-column>
				<el-table-column prop="last_aum" label="last_aum"  align></el-table-column>
				<el-table-column prop="diff" label="diff"  align></el-table-column>
				<el-table-column prop="kkupdatetime" label="updatetime"  align></el-table-column>
				
			</el-table>
			
			<div style="margin: 15px 5px; font-size: 20px;"> 
			scp /mnt/nfs_disk_5/ZTLP/purchase_redeem/dianshu.csv local111:/home/sun/alphaT_config/prod_configs/
			 </div>
			 <div style="margin: 15px 5px; font-size: 20px;">
			 local111:bash /home/sun/alphaT_config/prod_configs/update_dianshu.sh 
			</div>
				
		</div>
	<el-dialog :visible.sync="visible">
		<div style="display: flex;flex-flow: column; justify-content:center;">
			<div style="display: flex; justify-content:center;">
				<span style="color: orange;font-size: 24px; font-family: KaiTi, Helvetica, sans-serif;">return result </span>
			</div>
			<div style="display: flex;flex-flow:row; ">
				<P v-html="run_log" style="width: 100%; height: 600px;overflow-y: scroll;">
				</P>
			</div>
		</div>
	
	</el-dialog>
	</div>
</template>

<script>
	import headTop from '@/components/headTop'
	export default {
		data() {
			return {
				account_choice: "",
				account_options: [],
				date_choice: "",
				date_options: [],
				visible:false,
				allow_do_commond:false,
				run_log:'',
				count: 0,
				exchange_detail: [],
			
				screenWidth: document.body.clientWidth, // 屏幕尺寸
				screenHeight: document.body.clientHeight, // 屏幕尺寸
				arrange_data1: [],
				arrange_data2: [],
				arrange_data3: [],
				arrange_data4: [],
				arrange_data5: [],
				arrange_data6: [],
				arrange_data7: [],
				worker_list:[
					{
						value: '朱秀鹏',
						label: '朱秀鹏'
					},
					
					{
						value: '游雄凯',
						label: '游雄凯'
					},
					{
						value: '胡睦',
						label: '胡睦'
					},
					{
						value: '郭健',
						label: '郭健'
					},
					{
						value: '张边远',
						label: '张边远'
					},
					{
						value: '安姣姣',
						label: '安姣姣'
					},
					{
						value: '刘禹',
						label: '刘禹'
					},
					
				],
				status_options: [{
						value: '待处理',
						label: '待处理'
					},
					{
						value: '未出金',
						label: '未出金'
					},
					{
						value: '异常',
						label: '异常'
					},
					{
						value: '完成',
						label: '完成'
					},
					{
						value: '准备',
						label: '准备'
					},
					{
						value: '跟踪中',
						label: '跟踪中'
					},
				],
				yseno_options: [{
						value: 'yes',
						label: 'yes'
					},
					{
						value: 'no',
						label: 'no'
					},
					
				
				],
				
				direction_options: [{
						value: 'purchase',
						label: 'purchase'
					},
					{
						value: 'redeem',
						label: 'redeem'
					},
					
					{
						value: 'cashin',
						label: 'cashin'
					},
					
					{
						value: 'adjust',
						label: 'adjust'
					},
					
					
				
				],
			}
		},
		components: {
			headTop,
		},



		activated() {

			// console.log("当前登入用户", this.$store.state.adminInfo.name);
			//    if (this.tradesysPermission_list.indexOf (this.$store.state.adminInfo.permission) ==-1) {
			// 	console.log(this.$store.state.adminInfo.name,"未登入")
			// 	this.$message({type: 'error',	message: '没有权限',});
			// 	this.$router.push({
			// 		path: `/manage`
			// 	})
			// }
		},
		mounted() {
			// this.get_exchange_arrange()
			this.get_date_last()
		},
		computed: {  
		  
		} , 
		methods: {
			changedate_choice() {
				this.get_exchange_arrange()
			},

			changeaccount_choice() {
				this.get_exchange_arrange()
			},
			
			refleash() {
				this.get_exchange_arrange()
			},
			
			get_date_last() {
				var that = this
				
				
				let sql =" select date_format(date,'%Y-%m-%d') as kkdate ,date from `prod_purchase_redeem`  GROUP BY date;"
				that.$axios.post(that.lpapi2, "form=get_data&sql=" + sql).then(response => {
					console.log(response, 'data_tradesys_account');
					if (response.status = 200) {
						that.date_options = []
						//for (var i = 0; i < response.data.length; i++) {
						for (var i = response.data.length - 1; i >= 0; i--) {
							let char = {
								value: response.data[i]['kkdate'],
								label: response.data[i]['kkdate'],
							};
							that.date_options.push(char);
						}
						this.date_choice=response.data[response.data.length - 1]['kkdate']
						this.get_exchange_arrange()
					} else {
						console.log(response.data.statusCode);
					}
				})

			},
			addnew_arrange() {
				var that = this;
				var date = new Date();
				var seperator1 = "-";
				var year = date.getFullYear();
				var month = date.getMonth() + 1;
				var strDate = date.getDate();
				if (month >= 1 && month <= 9) {
					month = "0" + month;
				}
				if (strDate >= 0 && strDate <= 9) {
					strDate = "0" + strDate;
				}
				
			
				var currentdate = year + seperator1 + month + seperator1 + strDate;
				
				
				
				
				
				let sql2 = "INSERT INTO `prod_purchase_redeem`(`date`,`status`,`updatetime`,`action_type`,`future_in_transit`,`chg_amount_netvalue`,`chg_amount_cta`,`chg_to_today_portion`,`already_in_qry` \
				,`program_code`) VALUES ('" +currentdate + "','准备',CURRENT_TIMESTAMP,'purchase','','0','0','no','no','');"
				that.$axios.post(that.lpapi2, "form=do_sql&sql=" + sql2).then(response => {
					console.log(response, 'do_sql');
					if (response.status = 200) {
						this.$message({
							message: '新增完成',
							type: 'success'
						});
						this.get_exchange_arrange()
					} else {
						return
						console.log(response.data.statusCode);
					}
				})
			
			},
			change_cell($event, scope) {
				// console.log(scope.$index)
				var that = this
				console.log(scope)
				var arrange_data_item= this.arrange_data7[scope.$index]
				
				if (!isNaN(parseFloat(arrange_data_item['chg_amount_netvalue']))) {
					console.log(parseFloat(arrange_data_item['chg_amount_netvalue']))
					if (arrange_data_item['action_type']=='purchase' && parseFloat(arrange_data_item['chg_amount_netvalue'])<=0 ){
						this.$message({
							message: 'purchase chg_amount_netvalue 必须大于0',
							type: 'warning'
						});
						return
					}
					if (arrange_data_item['action_type']=='cashin' && parseFloat(arrange_data_item['chg_amount_netvalue'])<=0 ){
						this.$message({
							message: 'cashin chg_amount_netvalue 必须大于0',
							type: 'warning'
						});
						return
					}
					if (arrange_data_item['action_type']=='redeem' && parseFloat(arrange_data_item['chg_amount_netvalue'])>0 ){
						this.$message({
							message: 'redeem chg_amount_netvalue 必须小于0',
							type: 'warning'
						});
						return
					}
								
					
				}
				
				
				let sql2 = "UPDATE `prod_purchase_redeem` SET `action_type` = '" + arrange_data_item['action_type'] + "',   \
				   `date` = '" + arrange_data_item['kkdate'] + "', `program_code` = '" + arrange_data_item['program_code'] + "',   \
					`chg_amount_netvalue` = '" + arrange_data_item['chg_amount_netvalue'] + "', `chg_amount_cta` = '" + arrange_data_item['chg_amount_cta'] + "',   \
					`chg_to_today_portion` = '" + arrange_data_item['chg_to_today_portion'] + "', `already_in_qry` = '" + arrange_data_item['already_in_qry'] + "', \
					 `future_in_transit` = '" + arrange_data_item['future_in_transit'] + "', \
					`note` = '" + arrange_data_item['note'] + "', `status` = '" + arrange_data_item['status'] + "'\
					WHERE `id` = " + arrange_data_item['id'] + "  ;"
			
				that.$axios.post(that.lpapi2, "form=do_sql&sql=" + sql2).then(response => {
					console.log(response, 'do_sql');
					if (response.status = 200) {
						this.$message({
							message: '更新',
							type: 'success'
						});
						// this.get_exchange_arrange()
					} else {
						return
						console.log(response.data.statusCode);
					}
				})
			
			
			
			
			
			
			},
			change_cell_status($event, scope) {
				// console.log(scope.$index)
				var that = this
				console.log(scope['row']['id'],scope['row']['status'])
				// var arrange_data_item= this.arrange_data[scope.$index]
				
				
				
				let sql2 = "UPDATE `prod_purchase_redeem` SET `status` = '" + scope['row']['status'] + "'\
					WHERE `id` = " + scope['row']['id'] + "  ;"
			
				that.$axios.post(that.lpapi2, "form=do_sql&sql=" + sql2).then(response => {
					console.log(response, 'do_sql');
					if (response.status = 200) {
						this.$message({
							message: '更新',
							type: 'success'
						});
						// this.get_exchange_arrange()
					} else {
						return
						console.log(response.data.statusCode);
					}
				})
			
			
			
			
			
			
			},
			
			do_command(commond){
				
				var that = this;
				
				this.allow_do_commond=true
				let command_str = "python3 /home/market_data/web/trade/use_cashin_redeem3.py "
				command_str=command_str+this.date_choice.replace(/-/g, '')+" "+commond
				that.$axios.post(that.lpapi2, "form=do_command&command_str="+command_str).then(response => {
					console.log(response, 'do_sql');
					that.visible=true
					that.allow_do_commond=false
					
					if (response.data.hasOwnProperty('errmessage')) {
						that.run_log=response.data.errmessage.replace(/\n/g, '<br>')
						
						// this.$message({
						// 	message: response.data['errmessage'],
						// 	type: 'error'
						// });
						return
					} else {
						// this.$message({
						// 	message: '更新完成',
						// 	type: 'success'
						// });
						that.run_log=response.data.result.replace(/\n/g, '<br>')
						this.get_exchange_arrange()
						
					}
				})
				
			},
			
			get_exchange_arrange() {
				var that = this;
				console.log(that.lpapi2)
				// let flag1='入金'
				// if (this.inoutflag){
				// 	 flag1='出金'
				// }else{
				// 	 flag1='入金'
					
				// }
				
				
				let sql1 ="select * ,date_format(date,'%Y-%m-%d') as kkdate,date_format(updatetime,'%Y-%m-%d  %H:%i:%s') as kkupdatetime \
					from `prod_purchase_redeem` where    action_type='redeem' and status='未出金' ;"
				that.arrange_data1 = []
				that.$axios.post(that.lpapi2, "form=get_data&sql=" + sql1
				).then(response => {
					if (response.status = 200) {
						if (response.data[0].hasOwnProperty('message')) {
							that.arrange_data1 = []
						} else {
							that.arrange_data1= response.data;
						}
					} else {
						console.log(response.data.statusCode);
					}
				})
				
				let sql2 ="select * ,date_format(date,'%Y-%m-%d') as kkdate,date_format(updatetime,'%Y-%m-%d  %H:%i:%s') as kkupdatetime \
					from `prod_purchase_redeem` where   action_type='purchase' and status='跟踪中' ;"
				that.arrange_data2 = []
				that.$axios.post(that.lpapi2, "form=get_data&sql=" + sql2).then(response => {
					if (response.status = 200) {
						if (response.data[0].hasOwnProperty('message')) {
							that.arrange_data2 = []
						} else {
							that.arrange_data2= response.data;
						}
					} else {
						console.log(response.data.statusCode);
					}
				})
				let sql3 ="select * ,date_format(date,'%Y-%m-%d') as kkdate,date_format(updatetime,'%Y-%m-%d  %H:%i:%s') as kkupdatetime \
					from `prod_purchase_redeem` where  date  < '" + this.date_choice + "'  and status!='完成' ;"
				that.arrange_data3 = []
				that.$axios.post(that.lpapi2, "form=get_data&sql=" + sql3).then(response => {
					if (response.status = 200) {
						if (response.data[0].hasOwnProperty('message')) {
							that.arrange_data3 = []
						} else {
							that.arrange_data3= response.data;
						}
					} else {
						console.log(response.data.statusCode);
					}
				})

				
				
				let sql4 ="select * ,date_format(date,'%Y-%m-%d') as kkdate,date_format(updatetime,'%Y-%m-%d  %H:%i:%s') as kkupdatetime \
					from `pur_errorDic` where  date  = '" + this.date_choice + "' ;"
				that.arrange_data4 = []
				that.$axios.post(that.lpapi2, "form=get_data&sql=" + sql4).then(response => {
					if (response.status = 200) {
						if (response.data[0].hasOwnProperty('message')) {
							that.arrange_data4 = []
						} else {
							that.arrange_data4= response.data;
						}
					} else {
						console.log(response.data.statusCode);
					}
				})
				let sql5 ="select * ,date_format(date,'%Y-%m-%d') as kkdate,date_format(updatetime,'%Y-%m-%d  %H:%i:%s') as kkupdatetime \
					from `pur_locktargetT0Dic` where  date  = '" + this.date_choice + "' ;"
				that.arrange_data5 = []
				that.$axios.post(that.lpapi2, "form=get_data&sql=" + sql5).then(response => {
					if (response.status = 200) {
						if (response.data[0].hasOwnProperty('message')) {
							that.arrange_data5 = []
						} else {
							that.arrange_data5= response.data;
						}
					} else {
						console.log(response.data.statusCode);
					}
				})
				let sql6 ="select * ,date_format(date,'%Y-%m-%d') as kkdate,date_format(updatetime,'%Y-%m-%d  %H:%i:%s') as kkupdatetime \
					from `pur_dianshuDf` where  date  = '" + this.date_choice + "' ;"
				that.arrange_data6 = []
				that.$axios.post(that.lpapi2, "form=get_data&sql=" + sql6).then(response => {
					if (response.status = 200) {
						if (response.data[0].hasOwnProperty('message')) {
							that.arrange_data6 = []
						} else {
							that.arrange_data6= response.data;
						}
					} else {
						console.log(response.data.statusCode);
					}
				})
				let sql7 ="select * ,date_format(date,'%Y-%m-%d') as kkdate,date_format(updatetime,'%Y-%m-%d  %H:%i:%s') as kkupdatetime \
					from `prod_purchase_redeem` where  date='" + this.date_choice + "' ;"
				that.arrange_data7 = []
				that.$axios.post(that.lpapi2, "form=get_data&sql=" + sql7).then(response => {
					if (response.status = 200) {
						if (response.data[0].hasOwnProperty('message')) {
							that.arrange_data7 = []
						} else {
							that.arrange_data7= response.data;
						}
					} else {
						console.log(response.data.statusCode);
					}
				})
				
				
			},

			// tableRowClassNamemoneyout1({row,rowIndex}) {
			// 	if (this.arrange_data1[rowIndex]['status'] == '待处理' | this.arrange_data1[rowIndex]['status'] == '准备' ) {
			// 		return 'bacorange';
			// 	}
			// 	if (this.arrange_data1[rowIndex]['status'] == '异常') {
			// 		return 'bacOrangeRed';
			// 	}return '';
			// },
			// tableRowClassNamemoneyout2({row,rowIndex}) {
			// 	if (this.arrange_data2[rowIndex]['status'] == '待处理' | this.arrange_data2[rowIndex]['status'] == '准备' ) {
			// 		return 'bacorange';
			// 	}
			// 	if (this.arrange_data2[rowIndex]['status'] == '异常') {
			// 		return 'bacOrangeRed';
			// 	}return '';
			// },
			// tableRowClassNamemoneyout3({row,rowIndex}) {
			// 	if (this.arrange_data3[rowIndex]['status'] == '待处理' | this.arrange_data3[rowIndex]['status'] == '准备' ) {
			// 		return 'bacorange';
			// 	}
			// 	if (this.arrange_data3[rowIndex]['status'] == '异常') {
			// 		return 'bacOrangeRed';
			// 	}return '';
			// },
			tableRowClassNamemoneyout7({row,rowIndex}) {
				if (this.arrange_data7[rowIndex]['status'] == '待处理' | this.arrange_data7[rowIndex]['status'] == '准备' ) {
					return 'bacorange';
				}
				if (this.arrange_data7[rowIndex]['status'] == '异常') {
					return 'bacOrangeRed';
				}return '';
			},


			

		},
	}
</script>

<style>
	.el-table .bacOrangeRed {
		background: OrangeRed;
	}

	.el-table .bacorange {
		background: orange;
	}

	.el-table .success-row {
		background: grey;
		color: white;
	}

	.table_container {
		margin: 40px 5%;
		/* background-color: #0000FF; */
	}

	.el-table .grey {
		background: Silver;
	}

	.el-table .DarkGray {
		background: DarkGray;
	}

	.el-table .LightCoral {
		background: LightCoral;
		color: white;
	}

	.el-table .LimeGreen {
		background: LimeGreen;
	}

	.el-table .green {
		background: green;
	}

	.el-table .LightSlateGray {
		background: LightSlateGray;
	}

	.el-table .red {
		background: red;
		color: white;
	}

	.el-table .orange {
		background: NavajoWhite;
		color: black;
	}

	.el-table .blue {
		background: blue;
	}

	.el-table .purple {
		background: Violet;
		color: black;
	}

	.el-table .LightSteelBlue {
		background: LightSteelBlue;
	}

	.el-table .Goldenrod {
		background: Goldenrod;
	}

	.el-table .xingmu {
		background: Goldenrod;
		color: red;
		font-weight: bold;

	}


	.el-table .black {
		background: black;
		color: white;
	}

	.el-table .green {
		background: green;
		color: white;
	}

	.el-table .CornflowerBlue {
		background: CornflowerBlue;
		color: white;
	}

	.el-table .DodgerBlue {
		background: DodgerBluye;
	}
	

</style>
